/**
 * @fileOverview Flow
 * 流程类图图编辑器，适用于流程类、有向无环的 DAG 场景
 * 设计文档：https://www.yuque.com/antv/blog/g6-editor-design
 * @author huangtonger@aliyun.com
 */

const Page = require('../base/');
const Diagram = require('../diagram/');
const Util = require('./util/');

class Flow extends Diagram {
  constructor(inputCfg) {
    const cfg = {
      /**
       * graph cfg
       * @type {object|undefined}
       */
      graph: {
        modes: {
          default: [
            'panBlank', 'hoverGroupActived', 'keydownCmdWheelZoom',
            'clickEdgeSelected', 'clickNodeSelected', 'clickCanvasSelected', 'clickGroupSelected',
            'hoverNodeActived', 'hoverEdgeActived', 'hoverButton',
            'clickCollapsedButton', 'clickExpandedButton', 'wheelChangeViewport', 'keydownShiftMultiSelected',
            'dragNodeAddToGroup', 'dragOutFromGroup', 'panItem', 'hoverEdgeControlPoint', 'dragEdgeControlPoint'
          ],
          add: [ 'dragPanelItemAddNode' ],
          readOnly: [ 'panCanvas' ],
          move: [ 'panCanvas' ],
          multiSelect: [ 'dragMultiSelect' ]
        },
        mode: 'default',
        defaultIntersectBox: 'rect',
        nodeDefaultShape: 'flow-base',
        edgeDefaultShape: 'flow-smooth',
        groupDefaultShape: 'flow-base'
      },
      linkNode: false
    };
    const mixinCfg = {};
    Util.mix(true, cfg, mixinCfg, inputCfg);
    super(cfg);
    this.isFlow = true;
  }
}
Page.setRegister(Flow, 'flow', 'diagram');
module.exports = Flow;
